import _ from 'lodash';
import def from '../input/def';

export default _.defaultsDeep({
    component: 'jzlPageSelect',
    icon: 'fa fa-bars',
    name: '下拉选择',

    box_style: null,
    ele_style: {
        _name: '下拉选择',
        _se: [ "change", "focus", "blur" ],
        _sort: [ 'icon', 'label', 'body', 'rightIcon', 'options' ],

        label: {
            _ss: {
                "text": '列表选项'
            }
        },
        options: {
            _node: "list",
            _name: "选项列表（仅数据）",
            _value: 'options',

            label: {
                _name: "选项Label（仅数据）",
                _node: "text",
                _value: 'scope:label'
            },
            value: {
                _name: "选项值Value（仅数据）",
                _node: "text",
                _value: 'scope:value'
            }
        }
    },
    setting: {
        sticky: false
    },
    vars: [{
        prop: "model",
        type: "string",
        default: "",
        force: true,
        initType: "static",
        // initPath: "",
        // varName: "",    // page var name
        // emptyDefault: true,
        // api: null,
        // mbCode: null,
        // formCode: null,
        // viewCode: null,
        // itemName: null,
        // apiFilter: {},
        // mapiFilter: {}
    }, {
        prop: "options",
        type: "json",
        default: null,
        force: true,
        initType: "static",
        // initPath: "",
        // varName: "",    // page var name
        // emptyDefault: true,
        // api: null,
        // mbCode: null,
        // formCode: null,
        // viewCode: null,
        // itemName: null,
        // apiFilter: {},
        // mapiFilter: {}

        defaultJson: [{
            label: "选项一",
            value: 1
        }, {
            label: "选项二",
            value: 2
        }]
    }],
    data_mode: 'model-show',
    data_fieldsmap: {

    },
    data_schema: {       // 组件需要的字段
        "$schema": "http://json-schema.org/draft-04/schema#",
        "title": "数据列表",
        "description": "list description",
        "type": "array",
        "items": {
            "title": "",
            "type": "object",
            "properties": {
                "label": {
                    "title": "显示文字",
                    "type": "string"
                },
                "value": {
                    "title": "选项值",
                    "type": "string"
                }
            }
        }
    },
    data_type: 'static',    // static | dync
    data_dync: {},
    data_static: [{
        label: "选项一",
        value: 1
    }]
}, def);
